<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" pageEncoding="UTF-8"%>
<HTML>
	<HEAD>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="${pageContext.request.contextPath}/css/Style.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
			function addUser(){
				document.Form1.action = "userAction_add.do";
			}
		</script>


		<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js" type="text/javascript"></script>





	</HEAD>
	<body>
		<br>
		<form name="Form1" method="post"  action="${pageContext.request.contextPath}/user/findByInfo.action" id="Form1">
			<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
				<TBODY>
					<tr>
						<td class="ta_01" align="center" bgColor="#afd1f3">
							<strong>查 询 条 件</strong>
						</td>
					</tr>
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" border="0" width="100%">
								<tr>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										用户姓名
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<input name="loginName" class="bg"  value="${user.loginName}" size="15"/>
									</td>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										性别：
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<select name="sex" id="sex">
											<option value="">--选择性别--</option>
											<option value="男" ${user.sex == '男' ? 'selected': '' }>男</option>
											<option value="女" ${user.sex == '女' ? 'selected': '' }>女</option>
										</select>
									</td>
								</tr>
								<tr>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										学历：
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<select name="education" id="education" >
											<option value="">--选择学历--</option>
											<option value="博士" ${user.education == '博士' ? 'selected': '' }>博士</option>
											<option value="硕士" ${user.education == '硕士' ? 'selected': '' }>硕士</option>
											<option value="本科" ${user.education == '本科' ? 'selected': '' }>本科</option>
											<option value="专科" ${user.education == '专科' ? 'selected': '' }>专科</option>
											<option value="高中" ${user.education == '高中' ? 'selected': '' }>高中</option>
										</select>
									</td>

								</tr>
								<tr>
									<td width="100" height="22" align="center" bgColor="#f5fafe"
										class="ta_01">
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<font face="宋体" color="red"> &nbsp;</font>
									</td>
									<td align="right" bgColor="#ffffff" class="ta_01"><br><br></td>
									<td align="right" bgColor="#ffffff" class="ta_01">
										<input type="submit" id="search" name="search" value="查询" class="button_view" />
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<input type="reset" id="reset" name="reset" value="重置" class="button_view" />
									</td>
								</tr>
							</table>
						</td>

					</tr>
					<tr>
						<td class="ta_01" align="center" bgColor="#afd1f3">
							<strong>用 户 列 表</strong>
						</TD>
					</tr>
					<tr>
						<td class="ta_01" align="right">
							<a name="add"  class="button_add" href="${pageContext.request.contextPath}/user/add.jsp" id="add">添加</a>
						</td>
					</tr>
					<tr>
						<td class="ta_01" align="center" bgColor="#f5fafe">
							<table cellspacing="0" cellpadding="1" rules="all"
								bordercolor="gray" border="1" id="DataGrid1"
								style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
								<tr
									style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

									<td align="center" width="18%">
										登录名
									</td>
									<td align="center" width="17%">
										用户姓名
									</td>
									<td align="center" width="8%">
										性别
									</td>
									<td align="center" width="23%">
										联系电话
									</td>
									<td width="11%" align="center">
										学历
									</td>
									<td width="7%" align="center">
										编辑
									</td>
									<td width="7%" align="center">
										查看
									</td>
									<td width="7%" align="center">
										删除
									</td>
								</tr>
								<c:forEach items="${pageInfo.list}" var="user">
									<tr onmouseover="this.style.backgroundColor = 'white'"
										onmouseout="this.style.backgroundColor = '#F5FAFE';">
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="18%">
											${user.loginName}
										</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="17%">
												${user.loginName}
										</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="8%">
												${user.sex}
										</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="23%">
												${user.telephone}
										</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center">
												${user.education}
										</td>
										<td align="center" style="HEIGHT: 22px">
											<a href="${pageContext.request.contextPath}/user/edit.jsp">
												<img src="${pageContext.request.contextPath }/images/i_edit.gif" border="0" style="CURSOR: hand">
											</a>
										</td>
										<td align="center" style="HEIGHT: 22px">
											<a href="${pageContext.request.contextPath}/user/view.jsp">
												<img src="${pageContext.request.contextPath }/images/button_view.gif" border="0" style="CURSOR: hand">
											</a>
										</td>
										<td align="center" style="HEIGHT: 22px">
											<a href="#">
												<img src="${pageContext.request.contextPath }/images/i_del.gif" width="16" height="16" border="0" style="CURSOR: hand">
											</a>
										</td>
									</tr>
								</c:forEach>

							</table>
						</td>
					</tr>
					
					 <TR>
									<TD colspan="8">
										<SPAN id=pagelink>
											<DIV style="LINE-HEIGHT: 20px; HEIGHT: 20px; TEXT-ALIGN: right">
												共[<B>${pageInfo.total}</B>]条记录,[<B>${pageInfo.pages}</B>]页
												,每页显示
												<select name="pageSize" onchange="changePageSize()">

												<option value="1" ${pageInfo.pageSize == 1 ? 'selected':''}>1</option>
												<option value="2" ${pageInfo.pageSize == 2 ? 'selected':''}>2</option>
												<option value="20" ${pageInfo.pageSize == 20 ? 'selected':''}>20</option>
												</select>
												条
												<c:if test="${pageInfo.pageNum>1}">
													[<A href="javaScript:toPage(${pageInfo.prePage})">前一页</A>]
												</c:if>

												
												<B>${pageInfo.pageNum}</B>

												<c:if test="${pageInfo.pageNum<pageInfo.pages}">
													[<A href="javaScript:toPage(${pageInfo.nextPage})">后一页</A>]
												</c:if>


												
												到
												<input type="text" size="3" id="pageNum" name="pageNum" value="${pageInfo.pageNum}" />
												页

												<input type="button" value="Go"  onclick="go(${pageInfo.pages})"/>
											</DIV>
										</SPAN>
									</TD>
								</TR>
					
				</TBODY>

				<script>

					function go(pages) {


					if ($("#pageNum").val() > pages){
						alert("超出范围 , 请重新输入")
						return;
					}

					//执行翻页
					document.forms[0].submit();

					}

					function toPage(pageNum) {

						$("#pageNum").val(pageNum)
						document.forms[0].submit();

					}
					
				
					function changePageSize() {

						$("#pageNum").val(1)
						document.forms[0].submit();

					}
					
					
					
					
				</script>




			</table>
		</form>
	</body>
</HTML>
